package edu.notebook.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import edu.notebook.domain.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserDao extends BaseMapper<User> {

    /**
     * 根据用户名和密码查询用户
     * @param username
     * @param password
     * @return 匹配的用户对象
     */
    @Select("select * from user where username=#{username} and password=#{password}")
    User login(@Param("username") String username, @Param("password")String password);

    /**
     * 修改密码
     * @param id
     * @param password
     * @return 影响的行数
     */
    @Select("update user set password=#{password} where id=#{id}")
    int updatePassword(@Param("id") String id, @Param("password")String password);
}
